package com.tangyuan.common.util;

import java.util.Random;

public class RandomCodeUtil {
    public static String getRandomCode(){
        // 创建一个Random对象
        Random random = new Random();
        // 生成一个6位数字验证码
        StringBuilder verificationCode = new StringBuilder();
        for (int i = 0; i < 6; i++) {
            verificationCode.append(random.nextInt(10)); // 生成0到9之间的随机数
        }
        String code = verificationCode.toString();
        return code;
    }
}
